1. Field of the Invention
The present invention relates to a method and system for efficiently encoding data when the data is written in a storage device and, more particularly to an efficient encoding method of data for devices such as DVDs which have an ECC block format with a linear code ECC code such as a Reed-Solomon code.
2. Description of Related Art
In the technical field of multimedia, large capacity is needed for storage devices suitable for storing video images as animated picture images, characters and audio information. In order to meet the technical demand related to multimedia, a DVD-ROM has 4.7 GB and a DVD-RAM has 2.6 GB for one layer on a single side. The data structure of the DVD adopts an ECC block format shown in the right side of FIG. 1 to transfer the large capacity of data. The ECC block format includes 16 data sectors each of which has a size of 2064 B. The structure of each data sector is illustrated in FIG. 2. Source data written from a host such as a PC is divided based on a unit of 2 KB. 4 B of ID, 2 B of IED (an error detecting code of ID), 6 B of RSV (reserve) and 4 B of EDC (error detecting code) are added to the respectively divided source data, so that the total of 16 B is added to the source data. Thus, the data structure of 2048+16=2064 B=172 Bxc3x9712 rows is formed.
In the storage device such as the DVD, a direct writing on a disk is performed by using the 16 data sectors as one group. Thus, an error-correcting codes (ECC) is calculated based on a unit of 32 KB (16xc3x972 KB). As the error-correcting codes, a linear code such as the Reed-Solomon code is utilized. The code using the Reed-Solomon code has a redundancy of about 13% relative to data, so that the large numbers of errors can be corrected. Since methods for encoding the product code from the ECC block by using the Reed-Solomon code is well known, a simple explanation will be given thereto. In encoding the product code from the ECC block, each of byte columns in the vertical direction (column direction) is first encoded. The obtained ECC code of 16 B is provided after a corresponding column. The ECC code is called PO (Parity of Outer: outer code). Then, each of byte rows is encoded relative to the lateral direction (row direction) of the ECC block. The obtained ECC code of 10 B is provided after a corresponding row. The ECC code is called PI (Parity of Inner: inner code). Even if the column direction and the row direction are encoded in a reversed order to that used at an initial time, the result will be the same.
When the ECC block is written on a disk, one ECC block is converted into 16 physical sectors, as is well known. As illustrated in FIG. 3, 12 rows consisting of a data sector part and a PI part and one row of a PO portion in the ECC block are extracted and combined together so that an obtained sub-block becomes the base of one physical sector. In this case, combining 12 rows and one row of the ECC block together to form the sub-block (namely, physical sector) is referred to as interleaving. The sub-block generated by an interleaving operation is equally divided into 26 and a sync code (SY) of two bytes is added to the head of the sub-block. Thus, the physical sector of 2418 B can be obtained. The physical sector subjected to a required modulation processing is sequentially written on the disk 16 times, so that the ECC block 8 of the size of 32 KB is written on the disk.
A storage device such as a hard disk drive (HDD), a phase change type optical disk (for instance, PD), and MO does not employ an ECC block format in which the product code is formed and the length is long. Therefore, even when the source data is written on the disk from a PC side, as the source data is directly encoded or divided into some parts and encoded, the time required for encoding may be small. However, in the DVD, peculiar problems are generated. These problems will be described hereinafter.
Referring to FIG. 5, in a disk storage device such as the DVD using the ECC block format, a conventional writing sequence (1) to (6) when the 2 KB data of one data sector of the ECC block is rewritten will be described below.
(1) An encoding and decoding block 20 stores the data of 2 KB sent from a host in a first buffer 21. At the same time, the encoding and decoding block reads an ECC block on which the 2 KB data is to be written from a disk side and stores it in the first buffer 21.
(2) If the data read from the ECC block has an error, the error is corrected by an ECC decoder 24.
(3) In the first buffer 21, the corresponding data sector of the ECC block stored in the first buffer 21 is rewritten with the 2 KB data from the host.
The rewritten ECC block is transferred to a second buffer 22.
(4) The source data of the changed ECC block is sequentially sent to an encoder 23 from the second buffer 22, so that the PO portion of the ECC block is calculated.
(5) The calculated result of the PO portion is-sent to the first buffer 21 to rewrite the PO portion, so that the updated and complete ECC block is stored in the first buffer 21.
(6) This ECC block is written on the disk.
In practice, in (1), the data of the physical sector is read from the disk, and converted into ECC block data in the first buffer 21. In (6), the ECC block data is converted into the physical sector data and written in the disk.
According to such a conventional writing sequence, in (4), all bytes of columns must be transferred to the encoder 23 one by one. In (5), PO portions for all columns need to be calculated and the values of all PO portions cannot be written until they are obtained. Specifically, since the DVD utilizes the ECC block format, even when the source data of 2 KB for one data sector is written from the PC side, the ECC code using the Reed-Solomon code for all the ECC block having the size or capacity of 32 KB must be calculated again. Therefore, although it is necessary to write only the new data of 2 KB, it takes long time to encode the ECC block, so that writing efficiency is undesirably deteriorated. There may be possibly encountered a situation that when the calculating processing of the PO portions is not completed within a time until the disk rotates once and returns to the head of the same ECC block on the disk after one ECC block is read, a user must wait for the disk further rotating once. Particularly, in the case of a CLV (Constant Linear Velocity) system (for example, it takes time of 12.5 ms (inner periphery) to 29.6 ms (outer periphery)to rotate once on the track of a disk with small radius, for instance, at two times speed in the DVD), writing or updating performance has been significantly deteriorated.
Accordingly, it is an object of the present invention to provide a method and a system for efficiently encoding an ECC block and a rewritable DVD system to which the method is applied in order to improve a writing performance to a storage device using an ECC block format.
It is another object of the present invention to realize a new method for writing an ECC block on a disk before a processing related to an ECC is completed and improve a performance upon writing of the ECC block by using the linearity of a linear code such as a Reed-Solomon code.
The present invention was made by finding that processing when the data is written on a disk can be made more efficient by employing the linearity of a linear code such as a Reed-Solomon code. In the above described step (4), all the data (172 columns) of the ECC block are not encoded nor the PO portions of the ECC are formed. The PO portion is formed by considering only one or a plurality of data sectors which are updated.
The present invention provides a method for efficiently encoding the PO portion q2 of an updated ECC block F2 when updating the data f1 of a part of data sectors among a plurality of data sectors which form an ECC block F1 having an ECC code PO portion q1 formed with a linear code such as a Reed-Solomon code, with data f2. This method comprises a step of assuming an ECC block F1+F2 (xe2x80x9c+xe2x80x9d is used to mean an XOR computation, hereinafter) representing the XOR computation of the source data part of the ECC block F1 before updating and the ECC block F2 after updating, in which the data of the updated part of the data sectors is given by the XOR computation f1+f2 of the data f1 and the data f2 and it is assumed that the data of non-updated data sectors is 0; a step of obtaining the PO portion q1+q2 of the ECC block F1+F2 including a step of encoding the data f1+f2 of the updated part of the data sectors for each byte by an encoder and a step of encoding the data 0 of non-updated data sectors for each plurality of bytes by an encoder; and a step of obtaining the PO portion q2 of the updated ECC block F2 by carrying out the XOR computation of the PO portion q1+q2 of the ECC block F1+F2 and the PO portion q1 of the ECC block F1 before updating. The present invention further provides a system to which the method is applied and a rewritable DVD system to which the method is applied.